package com.salt.modules.flow.feign;

import com.salt.common.constant.Common;
import com.salt.modules.flow.entity.BusinessFlow;
import com.salt.modules.flow.hystrix.BusinessFlowClientHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Description 流程控制中心（业务流程）远程调用接口
 * @Author salt
 * @Date 2021/11/25
 * @Version 1.0.1
 */
@FeignClient(name = Common.Service.SALT_FLOW_SERVICE_NAME,
        path = Common.Service.SALT_FLOW_BUSINESS_URL_PREFIX,
        fallbackFactory = BusinessFlowClientHystrix.class)
public interface BusinessFlowClient {

    String API_PREFIX = "/client";
    String SAVE = API_PREFIX + "/save";
    String DELETE = API_PREFIX + "/delete";
    String FIND = API_PREFIX + "/find";

    @PostMapping(SAVE)
    public void save(@RequestBody BusinessFlow businessFlow);

    @PostMapping(DELETE)
    public void delete(@RequestParam("businessId") String businessId);

    @PostMapping(FIND)
    public BusinessFlow find(@RequestParam("businessId") String businessId);
}
